package com.octopus.samples.xici;

import com.octopus.core.Octopus;
import com.octopus.core.Request;
import java.util.concurrent.TimeUnit;

/**
 * 爬取西刺代理所有免费高匿代理
 *
 * @author shoulai.yang@gmail.com
 * @date 2019/08/06
 */
public class Main {

  public static void main(String[] args) {
    XiciProxyCollector collector = new XiciProxyCollector();
    new Octopus.Builder()
        .threads(1)
        .rateLimit(1, TimeUnit.SECONDS)
        .collector(collector)
        .autoStop()
        .parser(new XiciProxyParser())
        .build()
        .start(Request.me("https://www.xicidaili.com/nn/1").extra("page", 1));
    System.out.println(collector.getProxies());
  }
}
